(global.webpackJsonp = global.webpackJsonp || []).push([ [ "xg_o2o/additem/additem" ], {
    1560: function(e, t, i) {
        "use strict";
        (function(e) {
            function t(e) {
                return e && e.__esModule ? e : {
                    default: e
                };
            }
            i("4e1e"), t(i("66fd")), e(t(i("f417")).default);
        }).call(this, i("543d").createPage);
    },
    "53e6": function(e, t, i) {
        "use strict";
        i.d(t, "b", function() {
            return n;
        }), i.d(t, "c", function() {
            return o;
        }), i.d(t, "a", function() {
            return a;
        });
        var a = {
            gracePage: function() {
                return i.e("graceUI/components/gracePage").then(i.bind(null, "1915"));
            },
            graceFullLoading: function() {
                return i.e("graceUI/components/graceFullLoading").then(i.bind(null, "7669"));
            },
            divider: function() {
                return i.e("components/divider/divider").then(i.bind(null, "bdb7"));
            },
            graceSelectTags: function() {
                return i.e("graceUI/components/graceSelectTags").then(i.bind(null, "1e05"));
            },
            graceSelectImgAndUpload: function() {
                return Promise.all([ i.e("common/vendor"), i.e("graceUI/components/graceSelectImgAndUpload") ]).then(i.bind(null, "d7ef"));
            },
            graceDialog: function() {
                return i.e("graceUI/components/graceDialog").then(i.bind(null, "8d15"));
            }
        }, n = function() {
            this.$createElement, this._self._c;
        }, o = [];
    },
    "544f": function(e, t, i) {},
    "58e1": function(e, t, i) {
        "use strict";
        (function(e) {
            Object.defineProperty(t, "__esModule", {
                value: !0
            }), t.default = void 0;
            var i = {
                data: function() {
                    return {
                        bgColor: "",
                        textColor: "",
                        list: [],
                        childList: [],
                        categorys: [ [], [] ],
                        cateParent: [],
                        cateChild: [],
                        cateIndex: [ 0, 0 ],
                        attach: "",
                        isRelease: 0,
                        show2: !1,
                        graceFullLoading: !0,
                        pid: 0,
                        cid: 0,
                        catename: "请先选择分类",
                        demand: "",
                        orderAddrId: 0,
                        addressDetail: {},
                        orderDate: "",
                        orderTime: "",
                        uploadServerUrl: "",
                        marketprice: "",
                        payprice: "",
                        placeholder: "预约金不能低于10元",
                        expectprice: "",
                        uploadData: {},
                        minipay: 10,
                        content: "",
                        isWxPay: !1,
                        tmplIds: [],
                        showTextArea: !1,
                        iphonexHeight: 0,
                        iskefu: 2,
                        showBack: !1,
                        toTime: "",
                        issoon: 0,
                        soonVal: 1,
                        soon: [ {
                            name: "尽快上门",
                            value: "1",
                            checked: !0
                        }, {
                            name: "选择时间",
                            value: "2",
                            checked: !1
                        } ],
                        isexpect: 0
                    };
                },
                onLoad: function() {
                    var e = getCurrentPages();
                    this.showBack = e.length > 1, this.uploadServerUrl = this.$xRequest.url("entry/wxapp/v4uploadimg"), 
                    this.getinfo();
                },
                onReady: function() {
                    var e = this.$systemInfo.info();
                    this.iphonexHeight = e.iPhoneXBottomHeightPx;
                },
                onShow: function() {
                    var t = this;
                    e.$once("selectAddr", function(e) {
                        t.addressDetail = e.addressDetail, t.orderAddrId = e.addrid;
                    }), e.$once("selectDateTime", function(e) {
                        t.orderDate = e.orderDate, t.orderTime = e.orderTime;
                    }), e.$once("selectCoupon", function(i) {
                        if (i.coupon > 0) {
                            e.showLoading({
                                title: "加载中",
                                mask: !0
                            });
                            var a = t.$xSign.sign("v4coupon");
                            t.$xRequest.request({
                                url: "entry/wxapp/v4coupon",
                                data: {
                                    couponid: i.coupon,
                                    xgsign: a,
                                    op: "mycoupon"
                                },
                                success: function(a) {
                                    var n = 1 == t.issku ? t.skudata.price : t.marketprice, o = JSON.parse(t.$Decrypt(a.data.data));
                                    if (0 == a.data.errno && 0 == o.info) {
                                        var r = o.coupon;
                                        if (1 == r.type) if (n - r.filled >= 0) {
                                            t.couponid = i.coupon;
                                            var s = n - r.number;
                                            t.payprice = (s > 0 ? s : .01).toFixed(2), t.couponTxt = r.txt + "，还需支付" + t.payprice + "元";
                                        } else t.couponTxt = "此优惠券不可用", t.payprice = n, t.couponid = 0; else if (2 == r.type) {
                                            t.couponid = i.coupon;
                                            var d = n - r.number;
                                            t.payprice = (d > 0 ? d : .01).toFixed(2), t.couponTxt = r.txt + "，还需支付" + t.payprice + "元";
                                        } else {
                                            t.couponid = i.coupon;
                                            var c = n * r.number / 100;
                                            t.payprice = (c > 0 ? c : .01).toFixed(2), t.couponTxt = r.txt + "，还需支付" + t.payprice + "元";
                                        }
                                    }
                                    setTimeout(function() {
                                        e.hideLoading();
                                    }, 1e3);
                                }
                            });
                        }
                    });
                },
                methods: {
                    soonChange: function(e) {
                        this.soonVal = e;
                    },
                    columnchange: function(e) {
                        0 == e.detail.column && this.categorys.splice(1, 1, this.cateChild[this.cateParent[e.detail.value].id]);
                    },
                    bindTimeChange: function(e) {
                        this.pid = this.cateParent[e.detail.value[0]].id, this.cid = this.cateChild[this.pid][e.detail.value[1]].id, 
                        this.catename = this.cateParent[e.detail.value[0]].name + " / " + this.cateChild[this.pid][e.detail.value[1]].name;
                    },
                    clearAllImgs: function() {
                        this.$refs.selectimgandupload.clearAllImgs();
                    },
                    imgsChange: function(e) {
                        this.selectedimgs = e;
                    },
                    uploaderror: function() {
                        console.log("上传过程遇到错误");
                    },
                    imgLoaded: function(e) {
                        var t = new Array();
                        if (e.length > 0) {
                            for (var i = 0; i < e.length; i++) t[i] = e[i].url;
                            var a = t.join(",");
                            console.log("提交中"), this.confirmPay(a);
                        } else this.confirmPay("");
                    },
                    confirmPay: function(t) {
                        var i = this, a = this.payprice, n = this.marketprice;
                        e.showLoading({
                            title: "支付中",
                            mask: !0
                        }), this.isWxPay = !0;
                        var o = 1 == this.issoon && 1 == this.soonVal ? 1 : 0, r = this.$xSign.sign("v4pay");
                        this.$xRequest.request({
                            url: "entry/wxapp/v4pay",
                            data: {
                                xgsign: r,
                                payprice: a,
                                marketprice: n,
                                title: this.catename,
                                addrid: this.orderAddrId,
                                addrusername: this.addressDetail.username,
                                addrmobile: this.addressDetail.mobile,
                                addrname: this.addressDetail.district,
                                addrdetail: this.addressDetail.province,
                                addraddress: this.addressDetail.address,
                                addrlatlng: this.addressDetail.city,
                                orderDate: this.orderDate,
                                orderTime: this.orderTime,
                                orderRemarks: this.demand,
                                pid: this.pid,
                                cid: this.cid,
                                expect: this.expectprice,
                                action: "demand",
                                soon: o,
                                uploadimgs: t
                            },
                            success: function(t) {
                                var a = JSON.parse(i.$Decrypt(t.data.data));
                                if (t.data && a && !t.data.errno) {
                                    var n = a.ordertid;
                                    e.hideLoading(), wx.requestPayment({
                                        timeStamp: a.timeStamp,
                                        nonceStr: a.nonceStr,
                                        package: a.package,
                                        signType: "MD5",
                                        paySign: a.paySign,
                                        success: function(t) {
                                            i.isWxPay = !1, i.paybtn = "微信支付", e.showToast({
                                                title: "支付成功",
                                                icon: "none",
                                                duration: 800
                                            }), i.tmplIds.length > 0 ? wx.requestSubscribeMessage({
                                                tmplIds: i.tmplIds,
                                                complete: function(t) {
                                                    setTimeout(function() {
                                                        e.reLaunch({
                                                            url: "/xg_o2o/order/order"
                                                        });
                                                    }, 800);
                                                }
                                            }) : setTimeout(function() {
                                                e.reLaunch({
                                                    url: "/xg_o2o/order/order"
                                                });
                                            }, 800);
                                        },
                                        fail: function(t) {
                                            if (e.hideLoading(), i.isWxPay = !1, i.paybtn = "微信支付", "requestPayment:fail cancel" == t.errMsg) {
                                                var a = i.$xSign.sign("v4additem");
                                                i.$xRequest.request({
                                                    url: "entry/wxapp/v4additem",
                                                    data: {
                                                        xgsign: a,
                                                        op: "delorder",
                                                        ordertid: n
                                                    },
                                                    success: function(t) {
                                                        JSON.parse(i.$Decrypt(t.data.data)), e.showToast({
                                                            title: "支付取消",
                                                            icon: "none",
                                                            duration: 800
                                                        });
                                                    }
                                                });
                                            }
                                        }
                                    });
                                }
                            },
                            fail: function(t) {
                                i.isWxPay = !1, e.hideLoading(), wx.showModal({
                                    title: "系统提示",
                                    content: t.data.message ? t.data.message : "错误",
                                    showCancel: !1,
                                    success: function(t) {
                                        t.confirm && e.redirectTo({
                                            url: "/xg_o2o/additem/additem"
                                        });
                                    }
                                });
                            }
                        });
                    },
                    confirm: function() {
                        if (0 != this.pid && 0 != this.cid) if (this.demand) {
                            var t = /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/;
                            if (1 != this.isexpect || !this.expectprice || t.test(this.expectprice)) if (t.test(this.marketprice)) {
                                if (this.marketprice = parseFloat(this.marketprice).toFixed(2), isNaN(this.marketprice) || parseFloat(this.marketprice) < parseFloat(this.minipay)) return isNaN(this.marketprice) && (this.marketprice = ""), 
                                void e.showToast({
                                    title: "预约金不能低于" + this.minipay + "元",
                                    icon: "none"
                                });
                                0 != this.orderAddrId ? (2 != this.soonVal || 1 != this.issoon) && 2 != this.issoon || "" != this.orderTime && null != this.orderTime ? this.$refs.selectimgandupload.upload() : e.showToast({
                                    title: "请选择服务时间",
                                    icon: "none",
                                    duration: 800
                                }) : e.showToast({
                                    title: "请选择服务地址",
                                    icon: "none",
                                    duration: 800
                                });
                            } else e.showToast({
                                title: "预约金金额格式不正确",
                                icon: "none"
                            }); else e.showToast({
                                title: "期望价格格式不正确",
                                icon: "none"
                            });
                        } else e.showToast({
                            title: "请填写您的需求",
                            icon: "none"
                        }); else e.showToast({
                            title: "请选择服务分类",
                            icon: "none"
                        });
                    },
                    priceInput: function(e) {
                        var t = e.detail.value;
                        t < this.minipay ? this.payprice = this.minipay : this.payprice = t;
                    },
                    getCateId: function(e) {
                        this.pid = e.currentTarget.dataset.pid, this.cid = e.currentTarget.dataset.cid, 
                        this.catename = e.currentTarget.dataset.pname + " / " + e.currentTarget.dataset.name, 
                        this.closeDialog2();
                    },
                    showDialog2: function() {
                        this.show2 = !0;
                    },
                    closeDialog2: function() {
                        this.show2 = !1;
                    },
                    confirm2: function() {
                        this.closeDialog2(), e.showToast({
                            title: "您点击了确认按钮",
                            icon: "none"
                        });
                    },
                    getinfo: function() {
                        var t = this, i = this.$xSign.sign("v4additem");
                        this.$xRequest.request({
                            url: "entry/wxapp/v4additem",
                            data: {
                                xgsign: i,
                                op: "getinfo"
                            },
                            success: function(i) {
                                var a = JSON.parse(t.$Decrypt(i.data.data));
                                0 == i.data.errno && 1 == a.isrelease ? (t.iskefu = a.iskefu, t.graceFullLoading = !1, 
                                t.cateParent = a.parent, t.cateChild = a.child, t.bgColor = a.bgColor, t.textColor = a.textColor, 
                                t.isRelease = a.isrelease, t.attach = a.attach, t.list = a.parent, t.childList = a.child, 
                                t.orderAddrId = a.orderAddrId, t.addressDetail = a.addressDetail, t.isexpect = a.isexpect, 
                                t.minipay = a.minipay, t.payprice = a.minipay, t.content = a.content, t.tmplIds = a.tmplIds, 
                                t.issoon = a.issoon, t.toTime = a.totime, t.placeholder = "预约金不能低于" + a.minipay, 
                                setTimeout(function() {
                                    t.showTextArea = !0;
                                }, 20)) : (e.showToast({
                                    title: "发布模式未开启",
                                    duration: 2e3,
                                    icon: "none"
                                }), setTimeout(function() {
                                    e.reLaunch({
                                        url: "../index/index"
                                    });
                                }, 2e3));
                            }
                        });
                    }
                }
            };
            t.default = i;
        }).call(this, i("543d").default);
    },
    aa05: function(e, t, i) {
        "use strict";
        i.r(t);
        var a = i("58e1"), n = i.n(a);
        for (var o in a) "default" !== o && function(e) {
            i.d(t, e, function() {
                return a[e];
            });
        }(o);
        t.default = n.a;
    },
    c696: function(e, t, i) {
        "use strict";
        var a = i("544f");
        i.n(a).a;
    },
    f417: function(e, t, i) {
        "use strict";
        i.r(t);
        var a = i("53e6"), n = i("aa05");
        for (var o in n) "default" !== o && function(e) {
            i.d(t, e, function() {
                return n[e];
            });
        }(o);
        i("c696");
        var r = i("f0c5"), s = Object(r.a)(n.default, a.b, a.c, !1, null, null, null, !1, a.a, void 0);
        t.default = s.exports;
    }
}, [ [ "1560", "common/runtime", "common/vendor" ] ] ]);